<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .outter {
            position: relative;
            width: 400px;
            height: 400px;
            background-color: aqua;
        }

        .inner {
            position: absolute;
            width: 200px;
            height: 200px;
            background-color: beige;

            /* 核心 */
            /* 不一定全为0，只要四个值是一样的就行 */
            top: 0px;
            left: 0px;
            right: 0px;
            bottom: 0px;
            margin: auto;
        }
    </style>
</head>

<body>
    <div class="outter">
        <div class="inner">内部盒子</div>
    </div>
</body>

</html>